<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .borderbox{
            /** 
            内容宽高=盒子宽高-（border+padding）
            width和height是盒子宽高（包含border和内边距）
            */
            width: 100px;
            height:100px;
            border: 2px solid greenyellow;
            box-sizing: border-box;
            padding: 5px;
            background-color: aquamarine;
        }
        .contentbox{
            /** 
            盒子宽高=内容宽高+border+padding
            width和height是内容宽高（不包含border和内边距）
            */
            width: 100px;
            height:100px;
            border: 2px solid orange;
            box-sizing: content-box;
            padding: 5px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div>
        <div class="borderbox">abc</div>
        <div class="contentbox">abc</div>
    </div>
   
</body>
</html>